export function transformation (time, type) {
  time = new Date(time)
  let year = time.getFullYear()
  let month = time.getMonth() + 1
  month = month >= 10 ? month : '0' + month
  let date = time.getDate()
  date = date >= 10 ? date : '0' + date
  let hours = time.getHours()
  hours = hours >= 10 ? hours : '0' + hours
  let minutes = time.getMinutes()
  minutes = minutes >= 10 ? minutes : '0' + minutes
  let seconds = time.getSeconds()
  seconds = seconds >= 10 ? seconds : '0' + seconds
  let value
  if (type === 'time') {
    value = `${hours}:${minutes}:${seconds}`
  } else if (type === 'date') {
    value = `${year}-${month}-${date}`
  } else {
    value = `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`
  }
  return value
}
